﻿using System.Runtime.Serialization;
using System.ServiceModel.DomainServices.Client;

namespace Bede.Framework.UI.Comun
{
    [DataContract]
    public class ViewModelBaseWithContext<TDomainContext> : ViewModelBase where TDomainContext : DomainContext,new()
    {

        #region campos
        private static TDomainContext _contexto;
        #endregion

        #region propiedades
        /// <summary>
        /// Contiene una instancia estatica del contexto cliente
        /// </summary>
        public static TDomainContext Contexto
        {
            get {
                if (_contexto == null)
                    _contexto = new TDomainContext();
                return _contexto; 
            }

        }
        #endregion

    }
}
